<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title> globalThis对象 </title>
</head>

<body>


</body>

</html>
<script>
// 方法一
globalThis.name = "globalThis";
console.log(globalThis.name); // "globalThis"
window.name = "window";
console.log(window.name); // "window"
console.log(globalThis.name); 
</script>

<style> 

</style>